<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2023-02-02 10:58:48
 * @LastEditors: 
 * @LastEditTime: 2023-02-02 10:59:30
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <p>我是div中的p标签</p>
        <span>我是div中的span</span>
    </div>

    <script>
        // 获取div元素
        var divEle = document.querySelector('div');
        // 获取p元素
        var pEle = document.querySelector('p');

        // divEle.removeChild(pEle);

        var spanEle = document.querySelector('span');

        spanEle.remove();
    </script>
</body>
</html>